using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_ph_OHMap : EntityTypeConfiguration<so_ph_OH>
    {
        public so_ph_OHMap()
        {
            // Primary Key
            this.HasKey(t => new { t.location, t.expiry, t.SUMFIELDS, t.DIMFIELDS });

            // Properties
            this.Property(t => t.item)
                .HasMaxLength(10);

            this.Property(t => t.Description)
                .HasMaxLength(30);

            this.Property(t => t.location)
                .IsRequired()
                .HasMaxLength(3);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(26);

            this.Property(t => t.DIMFIELDS)
                .IsRequired()
                .HasMaxLength(15);

            // Table & Column Mappings
            this.ToTable("so_ph_OH");
            this.Property(t => t.item).HasColumnName("item");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.location).HasColumnName("location");
            this.Property(t => t.expiry).HasColumnName("expiry");
            this.Property(t => t.On_hand).HasColumnName("On_hand");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
            this.Property(t => t.DIMFIELDS).HasColumnName("DIMFIELDS");
        }
    }
}
